﻿#include "facer.h"
#include "ui_facer.h"

facer::facer(tcpclient *tc1,login *l,QWidget *parent) :
    tc1(tc1),l(l),QWidget(parent),
    ui(new Ui::facer)
{
    ui->setupUi(this);
    setWindowTitle(QString::fromLocal8Bit("一键换肤"));
     this->setWindowIcon(QIcon(":/photo/11.jfif"));
}

facer::~facer()
{
    delete ui;
}

//更换背景

void facer::on_pushButton_clicked()
{
    //换背景
    QImage _image;   //创建image
   _image.load(":/photo/back1.jpg");
   setAutoFillBackground(true);   // 这个属性一定要设置
    QPalette pal(palette());
     pal.setBrush(QPalette::Window, QBrush(_image.scaled(size(), Qt::IgnoreAspectRatio,Qt::SmoothTransformation)));
    setPalette(pal);

    l->setfacer(1);
    tc1->setfacer(1);

}


void facer::on_pushButton_2_clicked()
{
    //换背景
    QImage _image;   //创建image
   _image.load(":/photo/back2.jpg");
   setAutoFillBackground(true);   // 这个属性一定要设置
    QPalette pal(palette());
     pal.setBrush(QPalette::Window, QBrush(_image.scaled(size(), Qt::IgnoreAspectRatio,Qt::SmoothTransformation)));
    setPalette(pal);
    l->setfacer(2);
    tc1->setfacer(2);
}


void facer::on_pushButton_3_clicked()
{
    //换背景
    QImage _image;   //创建image
   _image.load(":/photo/back3.jpg");
   setAutoFillBackground(true);   // 这个属性一定要设置
    QPalette pal(palette());
     pal.setBrush(QPalette::Window, QBrush(_image.scaled(size(), Qt::IgnoreAspectRatio,Qt::SmoothTransformation)));
    setPalette(pal);
    l->setfacer(3);
    tc1->setfacer(3);
}


void facer::on_pushButton_4_clicked()
{
    //换背景
    QImage _image;   //创建image
   _image.load(":/photo/back4.jpg");
   setAutoFillBackground(true);   // 这个属性一定要设置
    QPalette pal(palette());
     pal.setBrush(QPalette::Window, QBrush(_image.scaled(size(), Qt::IgnoreAspectRatio,Qt::SmoothTransformation)));
    setPalette(pal);
    l->setfacer(4);
    tc1->setfacer(4);
}


void facer::on_pushButton_5_clicked()
{
    //换背景
    QImage _image;   //创建image
   _image.load(":/photo/back5.jpg");
   setAutoFillBackground(true);   // 这个属性一定要设置
    QPalette pal(palette());
     pal.setBrush(QPalette::Window, QBrush(_image.scaled(size(), Qt::IgnoreAspectRatio,Qt::SmoothTransformation)));
    setPalette(pal);

    l->setfacer(5);
    tc1->setfacer(5);
}


void facer::on_pushButton_6_clicked()
{
        //换背景
        QImage _image;   //创建image
       _image.load(":/photo/back6.jpg");
       setAutoFillBackground(true);   // 这个属性一定要设置
        QPalette pal(palette());
         pal.setBrush(QPalette::Window, QBrush(_image.scaled(size(), Qt::IgnoreAspectRatio,Qt::SmoothTransformation)));
        setPalette(pal);

        l->setfacer(6);
        tc1->setfacer(6);
}

